<?php

namespace app\index\controller;

use app\common\controller\ActionLogs;
use app\common\controller\Balance;
use app\common\controller\CardCustom;
use app\common\controller\Carddate;
use app\common\controller\CarddateNew;
use app\common\controller\CardPut;
use app\common\controller\CardPuttest;
use app\common\controller\Fztest;
use app\common\controller\UserBonusFee;
use app\common\model\CardConsume;
use app\common\model\CardCzLog;
use app\common\model\CardFans;
use app\common\model\CardFollowcardlog;
use app\common\model\CardFreecard;
use app\common\model\CardFreecardlog;
use app\common\model\CardGift;
use app\common\model\CardGivecardLog;
use app\common\model\CardLeaduser;
use app\common\model\CardMember;
use app\common\model\CardOrder;
use app\common\model\CardShareLog;
use app\common\model\CardShareRule;
use app\common\model\CardShareUser;
use app\common\model\CardUserBonus;
use app\common\model\CardUserGet;
use app\common\model\CardGeneral;
use app\common\model\CardPutRule;
use app\common\model\CardUserGetGift;
use app\common\model\CardUserUpdate;
use app\common\model\Momerchant;
use app\common\model\OpenTemplate;
use app\common\model\WxOpen;
use app\common\model\Agent;
use app\common\model\Merchant;
use app\merchant\controller\Qrcodes;
use app\common\model\System;
use think\Controller;
use think\Session;
use Wechat\Wxobjopen;
use Wnkj\WnCardObj;

class Wxcardpark extends Controller
{

    //接收到建卡信息并记录 会员卡
    public function createcardus($param){
        //获取存储数据
        $arr = $param['param'];
        $data = $param['create'];
        $res = $param['res'];
        $carddate = new Carddate();
        $CardMember = new CardMember();
        $datas = $carddate->addcard($arr, 2, $data, $res);
        $datas['card_info'] = json_encode($data, JSON_UNESCAPED_UNICODE);
        $CardMember->allowField(true)->save($datas);
    }

    //接收到建券信息并记录 优惠券
    public function createcards($param){
        //获取存储数据
        $datas=$param;
        $CardGeneral = new CardGeneral();
        $CardGeneral->allowField(true)->save($datas);
    }

    //接收到删卡信息并记录 会员卡
    public function delcardus($param){
        $map['card_id'] = $param['card_id'];
        $CardMember = new CardMember();
        $CardUserFee = new CardUserFee();
        $CardUserBonus = new CardUserBonus();
        $CardUserGet = new CardUserGet();
        $CardUpdate = new CardUserUpdate();
        $CardGivecardLog = new CardGivecardLog();
        $CardMember->where($map)->delete();
        $CardGivecardLog->where($map)->delete();
        $CardUpdate->where($map)->delete();
        $CardUserGet->where($map)->delete();
        $CardUserFee->where($map)->delete();
        $CardUserBonus->where($map)->delete();
    }

    //接收到删券信息并记录 优惠券
    public function delcards($param){
        $CardGeneral = new CardGeneral();
        $CardUserGet = new CardUserGet();
        $CardConsum = new CardConsume();
        $CardGivecardLog = new CardGivecardLog();
        $map['card_id'] = $param['card_id'];
        $datas['is_del'] = 2;
        $CardGeneral->save($datas, $map);
        $CardUserGet->save($datas, $map);
        $CardConsum->save($datas, $map);
        //END
        $sql ['zs_card_id'] = $param['card_id'];
        $CardGivecardLog->save($datas,$sql);
    }

  



}